#pragma once
#include "HTable.h"

namespace hzp {
	template<class K, class hash = Hash<K>>
	class My_Unordered_Set {
		struct SetKeyOfT {
			const K& operator()(const K& key) {
				return key;
			}
		};
	public:
		typedef typename openHash::HashBucket<K, K, SetKeyOfT, hash>::iterator iterator;
		iterator begin() {
			return _hb.begin();
		}
		iterator end() {
			return _hb.end();
		}
		pair<iterator, bool> insert(const K& key) {
			return _hb.Insert(key);
		}
	private:
		openHash::HashBucket<K, K, SetKeyOfT, hash> _hb;
	};
	void test_set() {
		My_Unordered_Set<int> mus;
		int a[] = { 4,14,34,7,24,17 };
		for (auto e : a)
			mus.insert(e);

		My_Unordered_Set<int>::iterator it = mus.begin();
		while (it != mus.end()) {
			cout << *it << " ";
			++it;
		}
		cout << endl;

		My_Unordered_Set<string> uss;
		uss.insert("sort");
		uss.insert("hash");
	}
}